﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class RegisterPanel : UIBase
{
    private InputField iptAccount;
    private InputField iptPassword;
    private InputField iptRTPassword;
  
    private Button btnRegister;
    private Button btnReset;
    private Button btnClose;
  
    // Start is called before the first frame update
    void Start()
    {
        uiType = UIType.RegisterPanel;
        UIManager.instance.Add(this);
        iptAccount = transform.Find("txtName/iptAccount").GetComponent<InputField>();
        iptPassword = transform.Find("txtPassword/iptpassword").GetComponent<InputField>();
        iptRTPassword = transform.Find("txtRTPassword/iptRTPassword").GetComponent<InputField>();
     
        btnRegister = transform.Find("btnRegister").GetComponent<Button>();
        btnClose = transform.Find("btnClose").GetComponent<Button>();
        btnReset = transform.Find("btnReset").GetComponent<Button>();
       
        btnRegister.onClick.AddListener(OnBtnRegister);
        btnClose.onClick.AddListener(OnBtnClose);
        btnReset.onClick.AddListener(OnBtnReset);
        this.gameObject.SetActive(true);
        HideUI();
    }

    private void OnBtnReset()
    {
        iptAccount.text = string.Empty;
        iptPassword.text = string.Empty;
        iptRTPassword.text = string.Empty;
    }

    private void OnBtnClose()
    {
        Application.Quit();
    }

    private void OnBtnRegister()
    {
        //1给服务器发消息，请求注册
    }

  
}
